-
Notifications
You must be signed in to change notification settings - Fork 1
fix: serialize decimals as quoted strings in JSON output #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: release-53.4.0
Are you sure you want to change the base?
fix: serialize decimals as quoted strings in JSON output #2
Conversation
Thank you for the patch! We need to fix tests here: Btw, does decimal deserializer properly works with input strings? |
I use |
Ok, it seems that deserializer also uses it https://github.com/tarantool/arrow-rs/blob/main/arrow-json/src/reader/decimal_array.rs#L57-L60, so it will be able to deserialize strings as decimals. |
Thank you for the patch! The last, but not least: let's squash commits keeping only meaningful ones (perhaps, reduce to one, but it's up to you) and add a bit of context about things are done. The rest LGTM. |
Add DecimalFormat enum with Number and String variants to control how decimal values are serialized in JSON output. The default Number format renders decimals as JSON numbers (e.g., 12.34), while String format renders them as quoted strings (e.g., "12.34"). Changes: - Add DecimalFormat enum to arrow-cast with Number (default) and String variants - Add decimal_format field to EncoderOptions and FormatOptions - Implement decimal formatting in DisplayIndexState for Decimal128/256 - Add WriterBuilder::with_decimal_format() configuration method - Add tests for decimal arrays, lists, and dictionaries - Fix lifetime elision warnings in BitChunks methods
9ba3b11
to
a0bb041
Compare
@novartole thank you for the review! I squashed the commits and created a more meaningful commit message. |
For correct serialization of decimal types into JSON we want them to be serialized as strings instead of numbers so they don't loose precision.